import 'package:flutter_ncsjqz_getx/http/dio_service.dart';
import 'package:flutter_ncsjqz_getx/model/friend_apply_list_entity.dart';
import 'package:get/get.dart';

class NewFriendLogic extends GetxController {
  List<FriendApplyListData>? data = [];

  getDATA() async{
    FriendApplyListEntity? baseEntity = await DioService<FriendApplyListEntity>().friendApplyList();
    if(baseEntity! .code == 0){
      data = baseEntity.data;
    }
    update();
  }

  // 1-通过，2-拒绝
  friendApplyOperate(int type,friendId) async{
    var map  = {
      "friendType": type,
      "friendUserId": friendId
    };
    FriendApplyListEntity baseEntity = await DioService<FriendApplyListEntity>().friendApplyOperate(map);
    if(baseEntity .code == 0){
      data = baseEntity.data;
      getDATA();
    }
    update();
  }


}
